<template>
    <div class="menber-center">
        <div class="heder">
            <!-- <p class="head">
                <img src="../../assets/imgs/member/head.png" alt="">
            </p>
            <p class="name">{{name}}</p> -->
            <!-- <div class="btn clearfix">
                <p class="lefst fl"  @click="direct('userinfo')">
                    <img src="../../assets/imgs/member/edit.png" alt="">
                    <span>编辑</span>
                </p>
                <p class="rights fr">
                    <img src="../../assets/imgs/member/setup.png" alt="">
                    
                    <span>设置</span>
                </p>
            </div> -->
            <ul class="clearfix">
                <li class="fl">
                    <img src="../../assets/imgs/member/money-1.png" alt="">
                    <span class="mon">{{infor.TJ_COUNT||0}}</span>
                    <span>推荐会员总数</span>
                </li>
                <li class="fl">
                    <img src="../../assets/imgs/member/money-2.png" alt="">
                    <span class="mon">{{infor.TJ_AMOUNT||0}}</span>
                    <span>奖励金总额</span>
                </li>
                <li class="fl">
                    <img src="../../assets/imgs/member/money-3.png" alt="">
                    <span class="mon">{{infor.TX_AMOUNT||0}}</span>
                    <span>累计提现金额</span>

                </li>
            </ul>
        </div>
        <div class="list">
            <ul class="clearfix">
                <li class="fl" @click="direct('recommendList')">
                    <img src="../../assets/imgs/member/bonus-1.png" alt="">
                    <span>推荐列表</span>
                </li>
                <li class="fl" @click="direct('bonusList')">
                    <img src="../../assets/imgs/member/bonus-2.png" alt="">
                    <span>奖励金列表</span>
                </li>
                <li class="fl" @click="direct('cashRecord')">
                    <img src="../../assets/imgs/member/bonus-3.png" alt="">
                    <span>提现记录</span>
                </li>
            </ul>
        </div>
        <div class="line"></div>
        <div class="lists">

        </div>
        <div class="line"></div>

        <div class="listme">
            <p>本周奖励金</p>
            <div class="tab">
                <ul class="clearfix">
                    <li class="fl">姓名</li>
                    <li class="fl">手机号</li>
                    <li class="fl">奖励金金额</li>
                    <li class="fl">获得日期</li>
                </ul>
            </div>
            <div class="tabs">
                <ul class="clearfix" v-for="list in lists">
                    <li class="fl">{{list.name.replace(/.(?=.)/g,'*')}}</li>
                    <li class="fl">{{list.mobile.replace(/^(\d{3})\d{4}(\d{4})$/,'$1****$2')}}</li>
                    <li class="fl">{{list.turnover}}</li>
                    <li class="fl">{{list.strOt.substring(0, 10)}}</li>
                </ul>
            </div>
        </div>
        <div class="tips" v-if="lists.length==0">
            <img src="../../assets/imgs/member/tips-1.png" alt="">
            <p>您暂无奖金记录～</p>
        </div>
        <div class="member" @click="direct('yqhy')">
            <img src="../../assets/imgs/member/center.png" alt="">
        </div>
        <!-- <div class="rule">
            查看会员规则
        </div> -->

    </div>
</template>

<script>
import http from "@/assets/js/axios";
import { domain } from '@/assets/js/config'
import $ from 'jquery'
import { Toast } from 'mint-ui';
export default {
    data() {
        return {
            isAshow: false,
            isBshow: false,
            userToken: '',
            infor: '',
            name: '',
            lists: [],
            datys: {
                dateType: 2
            }
        }
    },
    components: {

    },
    mounted() {
        let userToken = localStorage.getItem("token") || ''
        this.userToken = userToken
        if (!this.userToken) {
            this.$router.push('/login')
        }
        this.memberNow();
        this.inforNow();
        this.listNow();
    },
    methods: {
        direct: function (val) {
            this.$router.push({ path: '/' + val });
        },
        memberNow: async function () {
            const res = await http.post('xshk/f/user/countInfo?token=' + this.userToken)
            console.log(res);
            if (res.data.code == 0) {
                this.infor = res.data.data
                // this.lists = res.data.data.TJ_WEEK
            }
        },
        listNow: async function () {
            const res = await http.post('xshk/f/user/recommendList?token=' + this.userToken, this.datys)
            console.log(res);
            if (res.data.code == 0) {
                this.lists = res.data.data.TJ_WEEK
            }
        },
        inforNow: async function () {
            const res = await http.post('xshk/f/home/info?token=' + this.userToken)
            console.log(res);
            if (res.data.code == 0) {
                this.name = res.data.data.nickName
            }
        },
    }
}
</script>

<style lang="stylus" scoped>
.menber-center {
    .line {
        height: 12px;
        width: 100%;
        background: rgba(240, 240, 240, 1);
    }

    .heder {
        height: 200px;
        width: 100%;
        background-image: url('../../assets/imgs/member/bgc.png');
        background-size: 100%;
        background-repeat: no-repeat;

        ul {
            margin: 0 15px;
            padding-top: 50px;

            li {
                width: 33.3%;
                text-align: center;

                img {
                    margin: 0 auto;
                    display: block;
                    width: 34px;
                    height: 34px;
                }

                span {
                    margin: 10px 0;
                    display: block;
                    font-size: 14px;
                    font-family: Adobe Heiti Std R;
                    font-weight: normal;
                    color: rgba(102, 102, 102, 1);
                }

                .mon {
                    font-size: 20px;
                }
            }
        }
    }

    .list {
        ul {
            margin-bottom: 20px;

            li {
                width: 33.3%;
                text-align: center;

                img {
                    margin: 0 auto;
                    display: block;
                    width: 60px;
                    height: 60px;
                }

                span {
                    display: block;
                    font-size: 12px;
                    font-family: Adobe Heiti Std R;
                    font-weight: normal;
                    color: rgba(153, 153, 153, 1);
                }
            }
        }
    }

    .member {
        margin: 30px 0;
        width: 100%;
        height: 110px;
        text-align: center;

        img {
            margin: 0 auto;
            display: block;
            width: 345px;
            height: 100%;
        }
    }

    .listme {
        margin-top: 15px;

        p {
            padding: 0 15px;
            font-size: 16px;
            font-family: PingFangSC-Regular;
            font-weight: 400;
            color: rgba(0, 0, 0, 1);
        }

        div.tab {
            padding: 0 15px;
            margin-top: 10px;

            ul {
                text-align: center;

                li {
                    width: 25%;
                    font-size: 14px;
                    font-family: PingFangSC-Regular;
                    font-weight: 400;
                    color: rgba(153, 153, 153, 1);
                }
            }
        }

        div.tabs {
            margin: 0 15px;
            margin-top: 10px;
            border-bottom: 1px solid rgba(240, 240, 240, 1);

            ul {
                text-align: center;
                margin: 10px 0;

                li {
                    width: 25%;
                    font-size: 12px;
                    font-family: PingFangSC-Regular;
                    font-weight: 400;
                    color: rgba(51, 51, 51, 1);
                }
            }
        }
    }

    .rule {
        margin: 15px 20px;
        font-size: 14px;
        font-family: PingFangSC-Regular;
        font-weight: 400;
        color: rgba(0, 101, 252, 1);
        text-align: right;
    }

    .tips {
        margin-top: 20px;
        width: 100%;
        text-align: center;
        font-size: 16px;
        font-family: PingFangSC-Regular;
        font-weight: 400;
        color: rgba(221, 221, 221, 1);

        img {
            width: 100px;
            height: 100px;
        }
    }
}
</style>
